#pragma once
#include "COM_h.h"
#include "Define.h"


class CContain
{
private:
    DWORD m_dwRefCnt;
    IUnknown* m_lpAggregateUnknown;

public:
    CContain();
    ~CContain();

public:
    BEGIN_INTERFACE_PART(Contain, IContain)
        virtual HRESULT STDMETHODCALLTYPE ContainTest();
    END_INTERFACE_PART(Contain)
};

class CContainFactory : public IClassFactory
{
    DWORD m_nLockTick;
public:
    CContainFactory();
    ~CContainFactory();

public:
    inline DWORD GetReferences() const { return m_nLockTick; }

public:

    BEGIN_INTERFACE_TABLE()
        INTERFACE_TABLE_ENTRY(CContainFactory, IClassFactory)
    END_INTERFACE_TABLE()

    DECLARE_NONEW_INTERFACE()

    //
    //  IClassFactory
    //

    virtual HRESULT STDMETHODCALLTYPE CreateInstance(
        IN OPTIONAL IUnknown* pUnkOuter,
        IN REFIID riid,
        OUT void** ppvObject
    );
    virtual HRESULT STDMETHODCALLTYPE LockServer(IN BOOL fLock);

};

EXTERN_C CContainFactory ContainFactory;
